package authorize.controller;

import com.alibaba.fastjson.JSONObject;
import com.bosssoft.trainee.nontax.common.result.Result;
import com.bosssoft.trainee.nontax.entity.dto.TokenResult;
import com.bosssoft.trainee.nontax.entity.dto.UserInfo;
import com.bosssoft.trainee.nontax.service.AuthorizeClientService;
import com.bosssoft.trainee.nontax.service.RoleClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

/**
 * @author Luo Wenlong
 * @date 2022-07-05 14:30
 * @description:
 * @version:
 */
@RestController
public class AuthorizeController {
    @Qualifier("com.bosssoft.trainee.nontax.service.RoleClientService")
    @Autowired
    private RoleClientService authorizeClientService;

    @ResponseBody
    @RequestMapping("/user/login")
    public Result<TokenResult> login(@RequestBody JSONObject jsonObject){
        return authorizeClientService.login(jsonObject);
    }
    @ResponseBody
    @RequestMapping("/user/info")
    public Result<UserInfo> getInfo(@RequestParam String token) {
        return authorizeClientService.getInfo(token);
    }
}
